<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>文章列表--layui后台管理模板 2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="resources/css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" style="width:100%;" id="dataFrm">
<!--    <input type="hidden" id="linkCustNo" class="linkCustNo" name="linkCustNo"></input>-->

    <div class="layui-form-item">
 <!--       <div class="layui-inline">
            <label class="layui-form-label"><span style="color:red">* </span>编号</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input linkNo" name="linkNo" lay-verify="required" placeholder="">
            </div>
        </div>-->
        <div class="layui-inline">
            <label class="layui-form-label"><span style="color:red">* </span>公司编号</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input linkCustNo" name="linkCustNo" lay-verify="required"
                       placeholder="" id="linkCustNo" readonly>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label"><span style="color:red">* </span>姓名</label>
            <div class="layui-input-inline">

                <input type="text" class="layui-input linkName" name="linkName" lay-verify="required" placeholder="">
            </div>
        </div>
    </div>

    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block available">
            <input type="radio" name="linkSex" value="1" title="男" checked>
            <input type="radio" name="linkSex" value="0" title="女">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">职位</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input linkPosition" name="linkPosition"  placeholder="">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">办公电话</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input linkTelephone" name="linkTelephone"  placeholder="">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">手机</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input linkMobile" name="linkMobile"  placeholder="">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input linkRemark" name="linkRemark"  placeholder="">
            </div>
        </div>
    </div>

    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label"><span style="color:red">* </span>状态</label>
        <div class="layui-input-block available">
            <input type="radio" name="linkFlag" value="1" title="启用" checked>
            <input type="radio" name="linkFlag" value="0" title="禁用">
        </div>
    </div>

    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="addLinkman">立即添加</button>
            <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">取消</button>
        </div>
    </div>
</form>
<script type="text/javascript" th:src="@{resources/layui/layui.js}"></script>
<script th:inline="none">
    layui.use(['form','layer','laydate','table','laytpl','upload'],function() {
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table,
            upload=layui.upload;
        //form.render('select');
        form.on("submit(addLinkman)",function (data) {
           // var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            //实际使用时的提交数据
            var params=$("#dataFrm").serialize();
           /* var linkNo="ln"+ new Date().getTime();*/
            //var linkCustNo=$("#custNo").val();
            console.log(params);
            $.post("linkmans.do",params,function (res) {
                console.log(res.code);
                if(res.code==2001){
                   // top.layer.close(index);
                    top.layer.msg(res.msg);
                    var index1=parent.layer.getFrameIndex(window.name)
                    parent.layer.close(index1);
                    parent.location.reload();
                }else if(res.code=-1004){
                    layer.msg(res.msg);
                }else if(res.code=-2001){
                    layer.msg(res.msg);
                }
            },"json");
            return false;
        });
    });
</script>
</body>
</html>